home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / create3r / frmmain.frm (.txt) next >
Visual Basic Form  |  1999-08-27  |  6KB  |  188 lines

  1. VERSION 5.00
  2. Begin VB.Form frmMain 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Win Detective"
  5.    ClientHeight    =   3225
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   4680
  9.    Icon            =   "frmMain.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   3225
  14.    ScaleWidth      =   4680
  15.    ShowInTaskbar   =   0   'False
  16.    StartUpPosition =   3  'Windows Default
  17.    Begin VB.PictureBox Picture1 
  18.       BorderStyle     =   0  'None
  19.       Height          =   525
  20.       Left            =   90
  21.       Picture         =   "frmMain.frx":000C
  22.       ScaleHeight     =   525
  23.       ScaleWidth      =   525
  24.       TabIndex        =   12
  25.       Top             =   120
  26.       Width           =   525
  27.    End
  28.    Begin VB.Timer timMain 
  29.       Enabled         =   0   'False
  30.       Interval        =   100
  31.       Left            =   900
  32.       Top             =   2700
  33.    End
  34.    Begin VB.CommandButton cmdS 
  35.       Caption         =   "&Start"
  36.       Height          =   405
  37.       Left            =   2190
  38.       TabIndex        =   0
  39.       Top             =   2760
  40.       Width           =   1125
  41.    End
  42.    Begin VB.CommandButton cmdMain 
  43.       Caption         =   "&Close"
  44.       Height          =   405
  45.       Left            =   3510
  46.       TabIndex        =   6
  47.       Top             =   2760
  48.       Width           =   1125
  49.    End
  50.    Begin VB.Frame frMain 
  51.       Height          =   2055
  52.       Left            =   30
  53.       TabIndex        =   1
  54.       Top             =   630
  55.       Width           =   4605
  56.       Begin VB.TextBox txtMain 
  57.          BackColor       =   &H8000000F&
  58.          Height          =   315
  59.          Index           =   0
  60.          Left            =   1680
  61.          Locked          =   -1  'True
  62.          TabIndex        =   10
  63.          Top             =   330
  64.          Width           =   2805
  65.       End
  66.       Begin VB.TextBox txtMain 
  67.          BackColor       =   &H8000000F&
  68.          Height          =   315
  69.          Index           =   1
  70.          Left            =   1680
  71.          Locked          =   -1  'True
  72.          TabIndex        =   9
  73.          Top             =   720
  74.          Width           =   2805
  75.       End
  76.       Begin VB.TextBox txtMain 
  77.          BackColor       =   &H8000000F&
  78.          Height          =   315
  79.          Index           =   2
  80.          Left            =   1680
  81.          Locked          =   -1  'True
  82.          TabIndex        =   8
  83.          Top             =   1110
  84.          Width           =   2805
  85.       End
  86.       Begin VB.TextBox txtMain 
  87.          BackColor       =   &H8000000F&
  88.          Height          =   315
  89.          Index           =   3
  90.          Left            =   1680
  91.          Locked          =   -1  'True
  92.          TabIndex        =   7
  93.          Top             =   1500
  94.          Width           =   2805
  95.       End
  96.       Begin VB.Label lblMain 
  97.          Caption         =   "Window Class     :"
  98.          Height          =   285
  99.          Index           =   3
  100.          Left            =   120
  101.          TabIndex        =   5
  102.          Top             =   1560
  103.          Width           =   1305
  104.       End
  105.       Begin VB.Label lblMain 
  106.          Caption         =   "Window Parent   :"
  107.          Height          =   285
  108.          Index           =   2
  109.          Left            =   120
  110.          TabIndex        =   4
  111.          Top             =   1170
  112.          Width           =   1305
  113.       End
  114.       Begin VB.Label lblMain 
  115.          Caption         =   "Window Caption :"
  116.          Height          =   285
  117.          Index           =   1
  118.          Left            =   120
  119.          TabIndex        =   3
  120.          Top             =   780
  121.          Width           =   1305
  122.       End
  123.       Begin VB.Label lblMain 
  124.          Caption         =   "Window Handle  :"
  125.          Height          =   285
  126.          Index           =   0
  127.          Left            =   120
  128.          TabIndex        =   2
  129.          Top             =   390
  130.          Width           =   1305
  131.       End
  132.    End
  133.    Begin VB.Label Label1 
  134.       Caption         =   "Click The Button 'Start' To Activate Win Detective"
  135.       Height          =   255
  136.       Left            =   720
  137.       TabIndex        =   11
  138.       Top             =   210
  139.       Width           =   3795
  140.    End
  141. Attribute VB_Name = "frmMain"
  142. Attribute VB_GlobalNameSpace = False
  143. Attribute VB_Creatable = False
  144. Attribute VB_PredeclaredId = True
  145. Attribute VB_Exposed = False
  146. Private Sub cmdMain_Click()
  147. End Sub
  148. Private Sub cmdS_Click()
  149. 'Just for enabling and disabling the timer
  150. If cmdS.Caption = "&Start" Then
  151.     timMain.Enabled = True
  152.     cmdS.Caption = "&Stop"
  153.     cmdS.Caption = "&Start"
  154.     Screen.MousePointer = vbDefault
  155.     timMain.Enabled = False
  156. End If
  157. End Sub
  158. Private Sub timMain_Timer()
  159. Dim P As POINTAPI
  160. Dim hWn As Long
  161. Dim WinCap As String * 255
  162. Dim ClName As String * 255
  163. Dim OldParent As Long, Parent As Long
  164. 'First, get the cursor position of mouse
  165. GetCursorPos P
  166. 'WindowFromPoint returns the handle of the window under the mouse
  167. hWn = WindowFromPoint(P.x, P.y)
  168. txtMain(0).Text = hWn
  169. 'Determine the caption, using the handle we obtained above
  170. GetWindowText hWn, WinCap, 254
  171. txtMain(1).Text = WinCap
  172. If Trim(txtMain(1).Text) = "" Then txtMain(1).Text = "[No Caption Detected]"
  173. 'Find the parent using the GetParent function. The loop is for
  174. 'detecting the Zero-th level parent of our window
  175. Parent = GetParent(hWn)
  176. Do While Parent
  177. OldParent = Parent
  178. Parent = GetParent(OldParent)
  179. If Parent Then OldParent = Parent
  180. GetWindowText OldParent, WinCap, 254
  181. txtMain(2).Text = WinCap
  182. If Trim(txtMain(2).Text) = "" Then txtMain(2).Text = "[No Perent Detected]"
  183. 'Get the class name of our window
  184. GetClassName hWn, ClName, 254
  185. txtMain(3).Text = ClName
  186. If Trim(txtMain(3).Text) = "" Then txtMain(3).Text = "[No Class Detected]"
  187. End Sub
  188.